﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net.Mail;
using EntityObjects;
using System.Net;
namespace PresentationLayer.View.StoreClerk
{
    public class email
    {
        MailMessage m;
        private string to;
        private string message;
        private List<Catalogue> tablelst;


        //for Ma Lain Lain
        public email(string to) {
            this.to = to;
            this.message = "<font size=\"3\" face=\"Arial\">Dear Receiver,<br>" +
"By means of this letter, I delegate the authority herein described to you, on the following terms and conditions:<br>" +
"<ul><li>The delegate may review approve/reject, on my behalf,  requisition by department employee.</li>" +
"<li>The effective date of this delegation shall run until revoked by delegating official.</li>" +
"<li>The authority delegated is not subject to sub-delegation without my prior and express written consent.</li></ul></font>" +
"<br><font size=\"3\" face=\"Arial\" color=\"grey\">**********************************************************************" +
"<br>This is a Computer Generated Email. Please Do Not Reply to this Email Address. Thank You!" +
"<br>**********************************************************************</br></font>";
        }




        public email(string to,string message) {
            this.to = to;
            this.message = message;
        }
        public email(string to,string message,List<Catalogue> tablelst) {
            this.to = to;
            this.message = message;           
            this.tablelst = new List<Catalogue>();
            this.tablelst.AddRange(tablelst);
        }                
        public void createMail(){
        System.Net.Mail.MailMessage me = new System.Net.Mail.MailMessage();
            me.To.Add(to);
            me.Subject = "";
            me.From = new System.Net.Mail.MailAddress("ever.htarwaya@gmail.com");
            me.IsBodyHtml = true;
            me.Body = message;
            System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
            smtp.Host = "smtp.gmail.com";            
            smtp.Port =587; //for gmail
            smtp.EnableSsl = true;//SSL (true, false)
            smtp.Credentials = new NetworkCredential("sa34team12ad@gmail.com", "sa34team12ad");
            smtp.Send(me);
            smtp.Dispose();
        }
        

}
}